#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
using namespace std;

int gcd(int a, int b)
{
	return (b == 0 ? a : gcd(b, a % b));
}

const int N = (int)1e5 + 10;

int a[N], b[N];
int type[N];

int main()
{
	freopen ("input.txt", "r", stdin);
	freopen ("output.txt", "w", stdout);
	string str;
	while (cin >> str)
	{
		if (str == "#")
			break;
		int id = 0;
		for (int i = 0; i < (int)str.length(); i++)
		{
			if (str[i] == 'n')
				type[id++] = 1;
			else if (str[i] == 'w')
				type[id++] = 0;
		}
		if (type[id - 1] == 0)
		{
			a[id - 1] = 90;
			b[id - 1] = 1;
		}
		else
		{
			a[id - 1] = 0;
			b[id - 1] = 1;
		}
		int x = 1;
		for (int i = id - 2; i >= 0; i--)
		{
			if (type[i] == 0)
			{
				a[i] = 90 + 2 * a[i + 1];
				b[i] = (1 << x);
			}
			else
			{
				a[i] = 2 * a[i + 1] - 90;
				b[i] = (1 << x);
			}
			x++;
		}
		int g = gcd(a[0], b[0]);
		a[0] /= g, b[0] /= g;
		if (b[0] == 1)
			cout << a[0] << endl;
		else
			cout << a[0] << "/" << b[0] << endl;
	}
	return 0;
}